﻿<?php
 GLOBAL $CFG;
require_once('../../../config.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->dirroot . '/local/myplugin/lib.php');
require_once($CFG->dirroot . "/local/myplugin/forms.php");

global $DB;
$id = required_param('id', PARAM_TEXT);

/* Ket noi den file javascript - module.js */
$PAGE->requires->js_init_call('M.local_myplugin');	
$mycss =  $CFG->wwwroot.'/local/myplugin/css/mycss.css';
echo '<link rel="stylesheet" href="'.$mycss.'" type="text/css" media="screen" />';

/* Viet doan code cua ban o day */

$mylib = new curriculum_management();
$mform = new form_modify_major(null, array('id'=>$id));


//kiem tra neu dc submitted thì làm gì
if ($fromform = $mform->get_data()) 
{
	$option['id'] = $_POST['id'];
	$option['major_id']='';		//Hiện tại ko quản lý mã ngành học
	$option['major_name']=$fromform->txtten;
	$option['program_id']= $_POST['programid'];
	$mylib->update_major($option);
	//close colorbox
	echo "<script>parent.$.fn.colorbox.close(); </script>";
}

$mform->display();
/*------Ket thuc doan code cua ban-------*/
